﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MHPL_DoTrangSuc.Data;

namespace MHPL_DoTrangSuc.Bussiness
{
    class NhanVien
    {
        KetNoi kn = new KetNoi();
        string tenqt;
        string gioitinh;
        string email;
        string tendnqt;
        string matkhau;
        string nhaplaimatkhau;
       

        public string TENQT
        {
            get { return tenqt; }
            set { tenqt = value; }
        }

        public string GIOITINH
        {
            get { return gioitinh; }
            set { gioitinh = value; }
        }


        public string EMAIL
        {
            get { return email; }
            set { email = value; }
        }

        public string TENDNQT
        {
            get { return tendnqt; }
            set { tendnqt = value; }
        }

        public string MATKHAU
        {
            get { return matkhau; }
            set { matkhau = value; }
        }

        public string NHAPLAIMATKHAU
        {
            get { return nhaplaimatkhau; }
            set { nhaplaimatkhau = value; }
        }
        

        #region "Phuong thuc doi mat khau...................."
        
        public bool DoiMatKhau(string makhaumoi)
        {
            IDictionary<string, string> d = new Dictionary<string, string>();
            string truyvan = "update QuanTri set MatKhau = @matkhau where TenDNQT=@tendnqt";
            d.Add("@makhau", makhaumoi);
            d.Add("@tendnqt", TENDNQT);
            if (kn.ThucHienCauTruyVan(truyvan, d))
                return true;
            return false;
        }
        #endregion

        public bool UpdateNhanVien(int manhanvien)
        {

            IDictionary<string, string> d = new Dictionary<string, string>();
            string update = "update NhanVien set TenQT=@hoten,Email=@email,GioiTinh=@gioitinh where TenDNQT=" + tendnqt;
           
           // d.Add("@hoten", base.HOTEN);
            
           
          
           
          //  d.Add("@gioitinh", base.GIOITINH);
            
            if (kn.ThucHienCauTruyVan(update, d))
                return true;
            return false;
        }

       
    }
}
